\(\int \cot ^4(c+d x) (a+i a \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx\) [32]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 34, antiderivative size = 163 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=8 a^4 (A-i B) x-\frac {a^4 B \log (\cos (c+d x))}{d}-\frac {a^4 (8 i A+7 B) \log (\sin (c+d x))}{d}-\frac {a A \cot ^3(c+d x) (a+i a \tan (c+d x))^3}{3 d}-\frac {(2 i A+B) \cot ^2(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}+\frac {(4 A-3 i B) \cot (c+d x) \left (a^4+i a^4 \tan (c+d x)\right )}{d} \]

[Out]

8*a^4*(A-I*B)*x-a^4*B*ln(cos(d*x+c))/d-a^4*(8*I*A+7*B)*ln(sin(d*x+c))/d-1/3*a*A*cot(d*x+c)^3*(a+I*a*tan(d*x+c)
)^3/d-1/2*(2*I*A+B)*cot(d*x+c)^2*(a^2+I*a^2*tan(d*x+c))^2/d+(4*A-3*I*B)*cot(d*x+c)*(a^4+I*a^4*tan(d*x+c))/d

Rubi [A] (verified)

Time = 0.51 (sec) , antiderivative size = 163, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.118, Rules used = {3674, 3670, 3556, 3612} \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=-\frac {a^4 (7 B+8 i A) \log (\sin (c+d x))}{d}+\frac {(4 A-3 i B) \cot (c+d x) \left (a^4+i a^4 \tan (c+d x)\right )}{d}+8 a^4 x (A-i B)-\frac {a^4 B \log (\cos (c+d x))}{d}-\frac {(B+2 i A) \cot ^2(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}-\frac {a A \cot ^3(c+d x) (a+i a \tan (c+d x))^3}{3 d} \]

[In]

Int[Cot[c + d*x]^4*(a + I*a*Tan[c + d*x])^4*(A + B*Tan[c + d*x]),x]

[Out]

8*a^4*(A - I*B)*x - (a^4*B*Log[Cos[c + d*x]])/d - (a^4*((8*I)*A + 7*B)*Log[Sin[c + d*x]])/d - (a*A*Cot[c + d*x
]^3*(a + I*a*Tan[c + d*x])^3)/(3*d) - (((2*I)*A + B)*Cot[c + d*x]^2*(a^2 + I*a^2*Tan[c + d*x])^2)/(2*d) + ((4*
A - (3*I)*B)*Cot[c + d*x]*(a^4 + I*a^4*Tan[c + d*x]))/d

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3612

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c +
b*d)*(x/(a^2 + b^2)), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3670

Int[(((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]))/((a_.) + (b_.)*tan[(e_.)
 + (f_.)*(x_)]), x_Symbol] :> Dist[B*(d/b), Int[Tan[e + f*x], x], x] + Dist[1/b, Int[Simp[A*b*c + (A*b*d + B*(
b*c - a*d))*Tan[e + f*x], x]/(a + b*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a
*d, 0]

Rule 3674

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(-a^2)*(B*c - A*d)*(a + b*Tan[e + f*x])^(m - 1)*((c + d*Tan[e + f*x]
)^(n + 1)/(d*f*(b*c + a*d)*(n + 1))), x] - Dist[a/(d*(b*c + a*d)*(n + 1)), Int[(a + b*Tan[e + f*x])^(m - 1)*(c
 + d*Tan[e + f*x])^(n + 1)*Simp[A*b*d*(m - n - 2) - B*(b*c*(m - 1) + a*d*(n + 1)) + (a*A*d*(m + n) - B*(a*c*(m
 - 1) + b*d*(n + 1)))*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0] && E
qQ[a^2 + b^2, 0] && GtQ[m, 1] && LtQ[n, -1]

Rubi steps \begin{align*} \text {integral}& = -\frac {a A \cot ^3(c+d x) (a+i a \tan (c+d x))^3}{3 d}+\frac {1}{3} \int \cot ^3(c+d x) (a+i a \tan (c+d x))^3 (3 a (2 i A+B)+3 i a B \tan (c+d x)) \, dx \\ & = -\frac {a A \cot ^3(c+d x) (a+i a \tan (c+d x))^3}{3 d}-\frac {(2 i A+B) \cot ^2(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}+\frac {1}{6} \int \cot ^2(c+d x) (a+i a \tan (c+d x))^2 \left (-6 a^2 (4 A-3 i B)-6 a^2 B \tan (c+d x)\right ) \, dx \\ & = -\frac {a A \cot ^3(c+d x) (a+i a \tan (c+d x))^3}{3 d}-\frac {(2 i A+B) \cot ^2(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}+\frac {(4 A-3 i B) \cot (c+d x) \left (a^4+i a^4 \tan (c+d x)\right )}{d}+\frac {1}{6} \int \cot (c+d x) (a+i a \tan (c+d x)) \left (-6 a^3 (8 i A+7 B)-6 i a^3 B \tan (c+d x)\right ) \, dx \\ & = -\frac {a A \cot ^3(c+d x) (a+i a \tan (c+d x))^3}{3 d}-\frac {(2 i A+B) \cot ^2(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}+\frac {(4 A-3 i B) \cot (c+d x) \left (a^4+i a^4 \tan (c+d x)\right )}{d}+\frac {1}{6} \int \cot (c+d x) \left (-6 a^4 (8 i A+7 B)+48 a^4 (A-i B) \tan (c+d x)\right ) \, dx+\left (a^4 B\right ) \int \tan (c+d x) \, dx \\ & = 8 a^4 (A-i B) x-\frac {a^4 B \log (\cos (c+d x))}{d}-\frac {a A \cot ^3(c+d x) (a+i a \tan (c+d x))^3}{3 d}-\frac {(2 i A+B) \cot ^2(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}+\frac {(4 A-3 i B) \cot (c+d x) \left (a^4+i a^4 \tan (c+d x)\right )}{d}-\left (a^4 (8 i A+7 B)\right ) \int \cot (c+d x) \, dx \\ & = 8 a^4 (A-i B) x-\frac {a^4 B \log (\cos (c+d x))}{d}-\frac {a^4 (8 i A+7 B) \log (\sin (c+d x))}{d}-\frac {a A \cot ^3(c+d x) (a+i a \tan (c+d x))^3}{3 d}-\frac {(2 i A+B) \cot ^2(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}+\frac {(4 A-3 i B) \cot (c+d x) \left (a^4+i a^4 \tan (c+d x)\right )}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 1.15 (sec) , antiderivative size = 143, normalized size of antiderivative = 0.88 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=a^4 \left (\frac {7 A \cot (c+d x)}{d}-\frac {4 i B \cot (c+d x)}{d}-\frac {2 i A \cot ^2(c+d x)}{d}-\frac {B \cot ^2(c+d x)}{2 d}-\frac {A \cot ^3(c+d x)}{3 d}-\frac {8 i A \log (\tan (c+d x))}{d}-\frac {7 B \log (\tan (c+d x))}{d}+\frac {8 i A \log (i+\tan (c+d x))}{d}+\frac {8 B \log (i+\tan (c+d x))}{d}\right ) \]

[In]

Integrate[Cot[c + d*x]^4*(a + I*a*Tan[c + d*x])^4*(A + B*Tan[c + d*x]),x]

[Out]

a^4*((7*A*Cot[c + d*x])/d - ((4*I)*B*Cot[c + d*x])/d - ((2*I)*A*Cot[c + d*x]^2)/d - (B*Cot[c + d*x]^2)/(2*d) -
 (A*Cot[c + d*x]^3)/(3*d) - ((8*I)*A*Log[Tan[c + d*x]])/d - (7*B*Log[Tan[c + d*x]])/d + ((8*I)*A*Log[I + Tan[c
 + d*x]])/d + (8*B*Log[I + Tan[c + d*x]])/d)

Maple [A] (verified)

Time = 0.23 (sec) , antiderivative size = 115, normalized size of antiderivative = 0.71

method result size
derivativedivides \(\frac {a^{4} \left (-2 i A \left (\cot ^{2}\left (d x +c \right )\right )-\frac {A \left (\cot ^{3}\left (d x +c \right )\right )}{3}-4 i B \cot \left (d x +c \right )-\frac {B \left (\cot ^{2}\left (d x +c \right )\right )}{2}+7 A \cot \left (d x +c \right )+\frac {\left (8 i A +8 B \right ) \ln \left (\cot ^{2}\left (d x +c \right )+1\right )}{2}+\left (8 i B -8 A \right ) \left (\frac {\pi }{2}-\operatorname {arccot}\left (\cot \left (d x +c \right )\right )\right )-B \ln \left (\cot \left (d x +c \right )\right )\right )}{d}\) \(115\)
default \(\frac {a^{4} \left (-2 i A \left (\cot ^{2}\left (d x +c \right )\right )-\frac {A \left (\cot ^{3}\left (d x +c \right )\right )}{3}-4 i B \cot \left (d x +c \right )-\frac {B \left (\cot ^{2}\left (d x +c \right )\right )}{2}+7 A \cot \left (d x +c \right )+\frac {\left (8 i A +8 B \right ) \ln \left (\cot ^{2}\left (d x +c \right )+1\right )}{2}+\left (8 i B -8 A \right ) \left (\frac {\pi }{2}-\operatorname {arccot}\left (\cot \left (d x +c \right )\right )\right )-B \ln \left (\cot \left (d x +c \right )\right )\right )}{d}\) \(115\)
parallelrisch \(-\frac {a^{4} \left (2 A \left (\cot ^{3}\left (d x +c \right )\right )+12 i A \left (\cot ^{2}\left (d x +c \right )\right )+48 i B d x +48 i A \ln \left (\tan \left (d x +c \right )\right )-24 i A \ln \left (\sec ^{2}\left (d x +c \right )\right )-48 A d x +3 B \left (\cot ^{2}\left (d x +c \right )\right )+24 i B \cot \left (d x +c \right )-42 A \cot \left (d x +c \right )+42 B \ln \left (\tan \left (d x +c \right )\right )-24 B \ln \left (\sec ^{2}\left (d x +c \right )\right )\right )}{6 d}\) \(120\)
norman \(\frac {\frac {\left (-4 i B \,a^{4}+7 A \,a^{4}\right ) \left (\tan ^{2}\left (d x +c \right )\right )}{d}+\left (-8 i B \,a^{4}+8 A \,a^{4}\right ) x \left (\tan ^{3}\left (d x +c \right )\right )-\frac {A \,a^{4}}{3 d}-\frac {\left (4 i A \,a^{4}+B \,a^{4}\right ) \tan \left (d x +c \right )}{2 d}}{\tan \left (d x +c \right )^{3}}+\frac {4 \left (i A \,a^{4}+B \,a^{4}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}-\frac {\left (8 i A \,a^{4}+7 B \,a^{4}\right ) \ln \left (\tan \left (d x +c \right )\right )}{d}\) \(150\)
risch \(\frac {16 i a^{4} B c}{d}-\frac {16 a^{4} A c}{d}+\frac {2 a^{4} \left (36 i A \,{\mathrm e}^{4 i \left (d x +c \right )}+15 B \,{\mathrm e}^{4 i \left (d x +c \right )}-54 i A \,{\mathrm e}^{2 i \left (d x +c \right )}-27 B \,{\mathrm e}^{2 i \left (d x +c \right )}+22 i A +12 B \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{3}}-\frac {7 a^{4} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) B}{d}-\frac {8 i a^{4} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) A}{d}-\frac {a^{4} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B}{d}\) \(166\)

[In]

int(cot(d*x+c)^4*(a+I*a*tan(d*x+c))^4*(A+B*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

a^4/d*(-2*I*A*cot(d*x+c)^2-1/3*A*cot(d*x+c)^3-4*I*B*cot(d*x+c)-1/2*B*cot(d*x+c)^2+7*A*cot(d*x+c)+1/2*(8*B+8*I*
A)*ln(cot(d*x+c)^2+1)+(-8*A+8*I*B)*(1/2*Pi-arccot(cot(d*x+c)))-B*ln(cot(d*x+c)))

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 249, normalized size of antiderivative = 1.53 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=-\frac {6 \, {\left (-12 i \, A - 5 \, B\right )} a^{4} e^{\left (4 i \, d x + 4 i \, c\right )} + 54 \, {\left (2 i \, A + B\right )} a^{4} e^{\left (2 i \, d x + 2 i \, c\right )} + 4 \, {\left (-11 i \, A - 6 \, B\right )} a^{4} + 3 \, {\left (B a^{4} e^{\left (6 i \, d x + 6 i \, c\right )} - 3 \, B a^{4} e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, B a^{4} e^{\left (2 i \, d x + 2 i \, c\right )} - B a^{4}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 3 \, {\left ({\left (8 i \, A + 7 \, B\right )} a^{4} e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, {\left (-8 i \, A - 7 \, B\right )} a^{4} e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, {\left (8 i \, A + 7 \, B\right )} a^{4} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (-8 i \, A - 7 \, B\right )} a^{4}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right )}{3 \, {\left (d e^{\left (6 i \, d x + 6 i \, c\right )} - 3 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, d e^{\left (2 i \, d x + 2 i \, c\right )} - d\right )}} \]

[In]

integrate(cot(d*x+c)^4*(a+I*a*tan(d*x+c))^4*(A+B*tan(d*x+c)),x, algorithm="fricas")

[Out]

-1/3*(6*(-12*I*A - 5*B)*a^4*e^(4*I*d*x + 4*I*c) + 54*(2*I*A + B)*a^4*e^(2*I*d*x + 2*I*c) + 4*(-11*I*A - 6*B)*a
^4 + 3*(B*a^4*e^(6*I*d*x + 6*I*c) - 3*B*a^4*e^(4*I*d*x + 4*I*c) + 3*B*a^4*e^(2*I*d*x + 2*I*c) - B*a^4)*log(e^(
2*I*d*x + 2*I*c) + 1) + 3*((8*I*A + 7*B)*a^4*e^(6*I*d*x + 6*I*c) + 3*(-8*I*A - 7*B)*a^4*e^(4*I*d*x + 4*I*c) +
3*(8*I*A + 7*B)*a^4*e^(2*I*d*x + 2*I*c) + (-8*I*A - 7*B)*a^4)*log(e^(2*I*d*x + 2*I*c) - 1))/(d*e^(6*I*d*x + 6*
I*c) - 3*d*e^(4*I*d*x + 4*I*c) + 3*d*e^(2*I*d*x + 2*I*c) - d)

Sympy [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 292 vs. \(2 (143) = 286\).

Time = 2.47 (sec) , antiderivative size = 292, normalized size of antiderivative = 1.79 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=- \frac {B a^{4} \log {\left (\frac {4 A a^{4} - 3 i B a^{4}}{4 A a^{4} e^{2 i c} - 3 i B a^{4} e^{2 i c}} + e^{2 i d x} \right )}}{d} - \frac {i a^{4} \cdot \left (8 A - 7 i B\right ) \log {\left (e^{2 i d x} + \frac {4 A a^{4} - 4 i B a^{4} - a^{4} \cdot \left (8 A - 7 i B\right )}{4 A a^{4} e^{2 i c} - 3 i B a^{4} e^{2 i c}} \right )}}{d} + \frac {44 i A a^{4} + 24 B a^{4} + \left (- 108 i A a^{4} e^{2 i c} - 54 B a^{4} e^{2 i c}\right ) e^{2 i d x} + \left (72 i A a^{4} e^{4 i c} + 30 B a^{4} e^{4 i c}\right ) e^{4 i d x}}{3 d e^{6 i c} e^{6 i d x} - 9 d e^{4 i c} e^{4 i d x} + 9 d e^{2 i c} e^{2 i d x} - 3 d} \]

[In]

integrate(cot(d*x+c)**4*(a+I*a*tan(d*x+c))**4*(A+B*tan(d*x+c)),x)

[Out]

-B*a**4*log((4*A*a**4 - 3*I*B*a**4)/(4*A*a**4*exp(2*I*c) - 3*I*B*a**4*exp(2*I*c)) + exp(2*I*d*x))/d - I*a**4*(
8*A - 7*I*B)*log(exp(2*I*d*x) + (4*A*a**4 - 4*I*B*a**4 - a**4*(8*A - 7*I*B))/(4*A*a**4*exp(2*I*c) - 3*I*B*a**4
*exp(2*I*c)))/d + (44*I*A*a**4 + 24*B*a**4 + (-108*I*A*a**4*exp(2*I*c) - 54*B*a**4*exp(2*I*c))*exp(2*I*d*x) +
(72*I*A*a**4*exp(4*I*c) + 30*B*a**4*exp(4*I*c))*exp(4*I*d*x))/(3*d*exp(6*I*c)*exp(6*I*d*x) - 9*d*exp(4*I*c)*ex
p(4*I*d*x) + 9*d*exp(2*I*c)*exp(2*I*d*x) - 3*d)

Maxima [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 117, normalized size of antiderivative = 0.72 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=\frac {48 \, {\left (d x + c\right )} {\left (A - i \, B\right )} a^{4} - 24 \, {\left (-i \, A - B\right )} a^{4} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 6 \, {\left (-8 i \, A - 7 \, B\right )} a^{4} \log \left (\tan \left (d x + c\right )\right ) + \frac {6 \, {\left (7 \, A - 4 i \, B\right )} a^{4} \tan \left (d x + c\right )^{2} + 3 \, {\left (-4 i \, A - B\right )} a^{4} \tan \left (d x + c\right ) - 2 \, A a^{4}}{\tan \left (d x + c\right )^{3}}}{6 \, d} \]

[In]

integrate(cot(d*x+c)^4*(a+I*a*tan(d*x+c))^4*(A+B*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/6*(48*(d*x + c)*(A - I*B)*a^4 - 24*(-I*A - B)*a^4*log(tan(d*x + c)^2 + 1) + 6*(-8*I*A - 7*B)*a^4*log(tan(d*x
 + c)) + (6*(7*A - 4*I*B)*a^4*tan(d*x + c)^2 + 3*(-4*I*A - B)*a^4*tan(d*x + c) - 2*A*a^4)/tan(d*x + c)^3)/d

Giac [A] (verification not implemented)

none

Time = 0.98 (sec) , antiderivative size = 291, normalized size of antiderivative = 1.79 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=\frac {A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 12 i \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 3 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 24 \, B a^{4} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1\right ) - 24 \, B a^{4} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1\right ) - 87 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 48 i \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 384 \, {\left (-i \, A a^{4} - B a^{4}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + i\right ) - 24 \, {\left (8 i \, A a^{4} + 7 \, B a^{4}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right ) - \frac {-352 i \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 308 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 87 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 48 i \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 12 i \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + A a^{4}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3}}}{24 \, d} \]

[In]

integrate(cot(d*x+c)^4*(a+I*a*tan(d*x+c))^4*(A+B*tan(d*x+c)),x, algorithm="giac")

[Out]

1/24*(A*a^4*tan(1/2*d*x + 1/2*c)^3 - 12*I*A*a^4*tan(1/2*d*x + 1/2*c)^2 - 3*B*a^4*tan(1/2*d*x + 1/2*c)^2 - 24*B
*a^4*log(tan(1/2*d*x + 1/2*c) + 1) - 24*B*a^4*log(tan(1/2*d*x + 1/2*c) - 1) - 87*A*a^4*tan(1/2*d*x + 1/2*c) +
48*I*B*a^4*tan(1/2*d*x + 1/2*c) - 384*(-I*A*a^4 - B*a^4)*log(tan(1/2*d*x + 1/2*c) + I) - 24*(8*I*A*a^4 + 7*B*a
^4)*log(tan(1/2*d*x + 1/2*c)) - (-352*I*A*a^4*tan(1/2*d*x + 1/2*c)^3 - 308*B*a^4*tan(1/2*d*x + 1/2*c)^3 - 87*A
*a^4*tan(1/2*d*x + 1/2*c)^2 + 48*I*B*a^4*tan(1/2*d*x + 1/2*c)^2 + 12*I*A*a^4*tan(1/2*d*x + 1/2*c) + 3*B*a^4*ta
n(1/2*d*x + 1/2*c) + A*a^4)/tan(1/2*d*x + 1/2*c)^3)/d

Mupad [B] (verification not implemented)

Time = 7.62 (sec) , antiderivative size = 113, normalized size of antiderivative = 0.69 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=-\frac {\frac {A\,a^4}{3}-{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (7\,A\,a^4-B\,a^4\,4{}\mathrm {i}\right )+\mathrm {tan}\left (c+d\,x\right )\,\left (\frac {B\,a^4}{2}+A\,a^4\,2{}\mathrm {i}\right )}{d\,{\mathrm {tan}\left (c+d\,x\right )}^3}-\frac {a^4\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )\,\left (7\,B+A\,8{}\mathrm {i}\right )}{d}+\frac {8\,a^4\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B+A\,1{}\mathrm {i}\right )}{d} \]

[In]

int(cot(c + d*x)^4*(A + B*tan(c + d*x))*(a + a*tan(c + d*x)*1i)^4,x)

[Out]

(8*a^4*log(tan(c + d*x) + 1i)*(A*1i + B))/d - (a^4*log(tan(c + d*x))*(A*8i + 7*B))/d - ((A*a^4)/3 - tan(c + d*
x)^2*(7*A*a^4 - B*a^4*4i) + tan(c + d*x)*(A*a^4*2i + (B*a^4)/2))/(d*tan(c + d*x)^3)